CKeditor 5 out of the box does not come with upload capabilities. Uploading is supported with its plugins, some are official paid plugins that require subscriptions. There are a few free options.
Base64 upload adapter
This plugin allows uploads that will convert an uploaded image into base64 data. Very easy to use but will require you to save the complete base64 code with the post, this can be get long.
Docs
Simple image adapter
An image upload tool. It allows uploading images to an application running on your server using the XMLHttpRequest API with a minimal editor configuration.
Docs
Use the online builder to add the simple image adapter then download the generated bundle unzip and place the folder inside a publicly accessible place in Laravel. such as /public/js/ckeditor5
Then link ckeditor.js in the pages you want to use Ckeditor
<script src="/js/ckeditor5/build/ckeditor.js"></script>
Using Ckeditor in a textarea.
I've made a blade component called Ckeditor so I can use:
<x-form.ckeditor wire:model="content" name="content" />
To render the editor. I'm using Livewire and AlpineJS.
The component looks like this:
@props([ 'name' => '', 'label' => '', 'required' => false
])
@if ($label == '') @php //remove underscores from name $label = str_replace('_', ' ', $name); //detect subsequent letters starting with a capital $label = preg_split('/(?=[A-Z])/', $label); //display capi Recent Questions...
ما را در سایت Recent Questions دنبال می کنید
برچسب : نویسنده : استخدام کار superuser بازدید : 148 تاريخ : دوشنبه 24 بهمن 1401 ساعت: 21:10